import request from '@/utils/request'

/**
 * @description 列表
 * @param data
 * @returns
 */
export const getWechatGroupListApi: IGetWechatGroupListApi = function (params) {
  return request.get('htscrm/work/chat_list', { params });
};

/**
 * @description 详情
 * @param data
 * @returns
 */
export const getWechatGroupDetailApi: IGetWechatGroupDetailApi = function (id) {
  return request.get(`htscrm/users/info/${id}`);
};

/**
 * @description 添加
 * @param data
 * @returns
 */
export const addWechatGroupApi: IAddWechatGroupApi = function (data) {
  return request.post('htscrm/users/add', data);
};

/**
 * @description 编辑
 * @param data
 * @returns
 */
export const updateWechatGroupApi: IUpdateWechatGroupApi = function (data) {
  return request.post(`htscrm/users/edit/${data.id}`, data);
};

/**
 * @description 删除
 * @param data
 * @returns
 */
export const deleteWechatGroupApi: IDeleteWechatGroupApi = function (id) {
  return request.post(`htscrm/users/del/${id}`);
};

/**
 * 批量删除
 * @param ids
 * @returns
 */
export const batchDeleteWechatGroupApi: IBatchDeleteWechatGroupApi = function(ids) {
  return request.post(`htscrm/activity/delete`, {ids})
}

/**
 * 同步群
 * @param ids
 * @returns
 */
export const syncChatGroupApi = function() {
  return request.post(`htscrm/work/chat/sync`, {})
}

/**
 * 同步群成员
 * @param ids
 * @returns
 */
export const syncChatGroupUserApi = function(data:any) {
  return request.post(`htscrm/work/chat_user/sync`, data)
}

/**
 * 同步外部联系人
 * @param ids
 * @returns
 */
export const wechatUserApi = function(data:any) {
  return request.post(`htscrm/work/external/sync`, data)
}

/**
 * 同步关系
 * @param ids
 * @returns
 */
export const wechatRelationApi = function(data:any) {
  return request.post(`htscrm/work/external_relation/sync`, data)
}